<template>
	<view class="page-content">
		<zm-page-navview title="私人定制" :isBack="true" :borderBottom="false" slot="top" />
		<zm-captcha-verification-view ref="captV" 
		:mobile="fData.mobile" :sending="isInSending" :confirming="isInConfirming" 
		@getVerifyCode='getCodeRequest' @confirm="handleConfirmAccount"/>
	</view>
</template>

<script>
	export default {
		name: 'captchaVerifyPage',
		components: {
		},

		data() {
			return {
				fData: {
					mobile: '',
					password:'',
				},
				isInSending: false,
				isInConfirming: false,
			};
		},

		onLoad(options) {
			this.fData = options;
		},
		// 监听页面卸载
		onUnload() {
			
		},

		methods: {
			// 发送验证码请求
			getCodeRequest() {
				console.log(JSON.stringify(this.fData));
				uni.showLoading({
					mask: true,
					title: '请求中...',
				})
				this.isInSending = true;
				let that = this;
				setTimeout(() => {
					that.isInSending = false;
					uni.hideLoading();
					// 3、请求成功后就开始倒计时
					that.$refs.captV.startTimer()
				}, 1500);
			},
			
			// 账号请求
			handleConfirmAccount(e) {
				console.log("请求中:" + e)
				uni.showLoading({
					mask: true,
					title: '请求中...',
				})
				this.isInConfirming = true;
				let that = this;
				setTimeout(() => {
					that.isInConfirming = false;
					uni.hideLoading()
					// 业务处理...
					uni.reLaunch({
						url: '/pages/index/index'
					})
				}, 1500);
			},
		},
	}
</script>

<style lang="scss" scoped>
	.page-content {
		position: absolute;
		width: 100%;
		height: 100%;
		background: #F5F9FC;
	}
</style>
